package com.splant.android.smart.UILevel.Community.fragments;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.splant.android.R;
import com.splant.android.smart.ModelLevel.GatewayListBean;
import com.splant.android.smart.ModelLevel.WeatherStationListBean;
import com.splant.android.smart.SystemDefinedLevel.LRecyclerview.base.BaseMultiAdapter;
import com.splant.android.smart.SystemDefinedLevel.LRecyclerview.base.SuperViewHolder;

/**
 * Created by Administrator on 2017/8/17.
 */

public class Garden_WeatherStationList_Adapter extends BaseMultiAdapter<WeatherStationListBean.WeatherStation> {

    public Garden_WeatherStationList_Adapter(Context context) {
        super(context);
        addItemType(0, R.layout.garden_weatherstationlist_adapter_item);

    }
    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {

        TextView tv_weatherStationId=holder.getView(R.id.tv_weatherStationId);
        TextView tv_weatherStationName=holder.getView(R.id.tv_weatherStationName);
        TextView tv_weatherStationState=holder.getView(R.id.tv_weatherStationState);
        TextView weatherStationStartTime=holder.getView(R.id.tv_weatherStationStartTime);
        TextView tv_weatherStationEndTime=holder.getView(R.id.tv_weatherStationEndTime);

        WeatherStationListBean.WeatherStation weatherStation=getDataList().get(position);
        tv_weatherStationId.setText(weatherStation.getMeteoId());
        tv_weatherStationName.setText(weatherStation.getMeteoName());

        if (weatherStation.getMeteoState()==1)
        {
            tv_weatherStationState.setText("在线");
        }
        else if (weatherStation.getMeteoState()==2)
        {
            tv_weatherStationState.setText("离线");
        }
        else
        {
            tv_weatherStationState.setText("未组网");
        }

        weatherStationStartTime.setText(weatherStation.getStOnLine());
        tv_weatherStationEndTime.setText(weatherStation.getEtOnLine());

    }

}
